using MicroMsg.Manager;
using MicroMsg.Plugin.Sns.Scene;
using MicroMsg.UI.Page;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
namespace MicroMsg.UI.UserContrl
{
	public class HttpPicItem : SnsHttpImgCtrlBase
	{
		private const string TAG = "HttpPicItem";
		private string strUrl;
		internal Canvas LayoutRoot;
		internal Image image;
		private bool _contentLoaded;
		public HttpPicItem()
		{
			this.InitializeComponent();
			this.LayoutRoot.set_Background(R.theme.SNS_USERPAGEITEM_TAKEPHOTO_BK_BRUSH);
		}
		protected override void ObjectCome(object object_0)
		{
			if (object_0 != null && object_0 is snsMediaDownloadInfo)
			{
				snsMediaDownloadInfo snsMediaDownloadInfo = object_0 as snsMediaDownloadInfo;
				SnsMediaMgr.getImg(snsMediaDownloadInfo, true);
				if (snsMediaDownloadInfo.object_0 != null && snsMediaDownloadInfo.object_0 is BitmapImage && this.strUrl == snsMediaDownloadInfo.string_0)
				{
					this.image.set_Source(snsMediaDownloadInfo.object_0 as BitmapImage);
				}
				return;
			}
		}
		public void LoadImage(string string_0, bool bIsSyncLoad = true)
		{
			if (string.IsNullOrEmpty(string_0))
			{
				return;
			}
			this.strUrl = string_0;
			this.image.set_Height(base.get_Height());
			this.image.set_Width(base.get_Width());
			snsMediaDownloadInfo snsMediaDownloadInfo = new snsMediaDownloadInfo
			{
				string_0 = this.strUrl,
				urlType = SnsUrlType.MMSNS_URL_CDN,
				snsObjID = 1uL,
				priority = SnsPriority.LOW
			};
			this.image.set_Source(null);
			base.StartRequest(snsMediaDownloadInfo, bIsSyncLoad);
			if (snsMediaDownloadInfo.object_0 != null && snsMediaDownloadInfo.object_0 is BitmapImage)
			{
				this.image.set_Source(snsMediaDownloadInfo.object_0 as BitmapImage);
			}
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/Plugin/TXBlogRead/UI/HttpPicItem.xaml", 2));
			this.LayoutRoot = (Canvas)base.FindName("LayoutRoot");
			this.image = (Image)base.FindName("image");
		}
	}
}
